package stdlib.lang

import java.nio.charset.Charset
import java.util.concurrent.TimeUnit


fun testProcess(){
    val process = Runtime.getRuntime().exec(arrayOf("bash","-c","reboot -al"))
    process.waitFor(5,TimeUnit.SECONDS)
    println("${process.inputStream.available()}  ${process.errorStream.available()}")
    var data = process.inputStream.readAllBytes()
    println("ok: ${data.toString(Charset.defaultCharset())}")
    data = process.errorStream.readAllBytes()
    println("err: ${data.toString(Charset.defaultCharset())}")
}

fun test(){
    val result = ExeCommand().run("dir",1000).getResult()
    println(result)
}

fun main() {
    testProcess()
    test()
}